Skip to content

ENH: Add stub file. #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sabonerune
Copy link
Contributor

It's almost a copy of pyworld.pyx.
Features are minimal to support older Python and Numpy.

Copy link
Contributor Author

@sabonerune sabonerune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simple type hint that's better than nothing.

@@ -0,0 +1,399 @@
from typing import Optional, Tuple
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typing.Tuple is Deprecated.
However, removing this requires Python 3.9 (or maybe Python 3.7).
https://docs.python.org/3.13/library/typing.html#typing.Tuple

@@ -32,6 +32,7 @@
cmdclass={'build_ext': build_ext},
version=_VERSION,
packages=find_packages(),
package_data={"": ["py.typed", "*.pyi"]},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If setuptools>=v69.0.0 this code is not needed.
https://setuptools.pypa.io/en/latest/history.html#id256

But this is only supported in Python >= 3.8.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typing of ndarrays is minimal.
It would be great if we could type hint it like this:

def synthesize(
    f0: np.ndarray[tuple[int], np.dtype[np.double]],
    spectrogram: np.ndarray[tuple[int, int], np.dtype[np.double]],
    aperiodicity: np.ndarray[tuple[int, int], np.dtype[np.double]],
    fs: int,
    frame_period: float
) -> np.ndarray[tuple[int], np.dtype[np.double]]:...

But this is probably supported in numpy>=1.22 and Python>=3.9.
Python 3.10 supports Numpy 1.21.6, so it wouldn't be easy to add it without dropping one of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant